<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<!DOCTYPE html>
<html>
<head>
<title>账户注册</title>
</head>
<body>
  <div style="text-align: center">
    <form name="register" action="account-handler" method="post">
      <fieldset>
        <legend>注册账户</legend>
        <input type="hidden" name="operate" value="add-account" readonly="readonly">
        <label>账户<input type="text" name="account-name" placeholder="最多10个字符" onblur="verify()"></label>
        <br>
        <label>密码<input type="password" name="password" placeholder="最多10个字符" onblur="verify()"></label>
        <br>
        <label>确认<input type="password" placeholder="重复键入密码" name="confirm-password"></label><br>
        <input type="submit" value="注册" onclick="return verify()">
      </fieldset>
    </form>
    <a href="login">转到登录页</a>
  </div>
</body>
<script language="JavaScript">
  function verify() {
    var accountName = document.register["account-name"].value;
    var password = document.register.password.value;
    var confirmPassword = document.register["confirm-password"].value;
    if (accountName === null || password === null || confirmPassword === null)
      return false;
    if (accountName === "" || password === "" || confirmPassword === "")
      return false;
    return !(accountName === password || password !== confirmPassword);
  }
</script>
</html>
